<!doctype html>
<html>
<head>
    <include file="public/head"/>
    <title>千佰特留言板管理</title>
    <meta name="description" content="千佰特留言板管理">
    <meta name="keywords" content="千佰特留言板管理">
    <style>
        #inputbox{
            padding-left: 480px;
        }
        .margin-top-20 {
            margin-top: 2px !important;
            margin-bottom: 2px;
        }
        .well{
            padding:10px;
        }
        .table-actions{
            margin-bottom: 2px;
        }
    </style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>留言板</a></li>
    </ul>
    <form class="well form-inline margin-top-20" class="js-ajax-form" method="post" action="{:cmf_plugin_url('QbtGuestbook://AdminIndex/index')}">

        <div id="inputbox">

            搜索相关内容：
            <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{:input('request.keyword')}"
                   placeholder="内容">
            <input type="submit" class="btn btn-primary" value="搜索"/>
            <!-- <a class="btn btn-danger" href="{:cmf_plugin_url('QbtGuestbook://AdminIndex/index')}">清空</a> -->
        </div>
    </form>
    <form method="post" class="js-ajax-form margin-top-20" action="#">
        <div class="table_list">
            <div class="table-actions">
                <button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
                        data-action="{:cmf_plugin_url('QbtGuestbook://AdminIndex/deletes')}" data-subcheck="true" data-msg="您确定删除吗？">
                    {:lang('DELETE')}
                </button>
            </div>
            <table width="100%" class="table table-hover">
                <thead>
                <tr>
                    <th width="15">
                        <label>
                            <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                        </label>
                    </th>
                    <th>名称</th>
                    <th>email</th>
                    <th>电话</th>
                    <th>内容</th>
                    <th>时间</th>
                    <th width="120">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php
                    if(count($lists)>0){
                        foreach($lists as $val){
                ?>
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$val.id}" title="ID:{$val.id}">
                    </td>  
                    <td>{$val['name']}</td>
                    <td>{$val['email']}</td>
                    <td>{$val['tel']}</td>
                    <td style="display:none">{$val['content']}</td>
                    <td class="content" style="cursor: pointer;">{:mb_substr($val['content'], 0, 20, 'utf-8') .'...'}</td>
                    <input type="hidden" name="content" value="{$val['content']}">
                    <td>{:date('Y-m-d H:i:s',$val['addtime'])}</td>
                    <td width="120">
                        <a href="{:cmf_plugin_url('QbtGuestbook://AdminIndex/delete',['id'=>$val['id']])}" class="js-ajax-delete">删除</a>
                    </td>
                </tr>
                <?php
                        }
                    }else{
                ?>
                <tr><td colspan="4">暂无留言</td></tr>
                <?php
                    }
                ?>
                </tbody>
            </table>
            <div class="pagination">{$page}</div>
        </div>
    </form>
</div>
<include file="public/scripts"/>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script>
    var index = '';
    $(".content").click(function(){
       var v = $(this).prev().text();
       index = layer.open({
           title:'详细内容',
           shade: 0,
           content: v
       })
    });

    // $(".content").mouseleave(function(){
    //     layer.close(index);
    // });


</script>
</body>
</html>